"""
确保 Playwright 能在打包应用中找到其驱动和浏览器
"""
import os
import sys

# 设置 Playwright 路径
if getattr(sys, 'frozen', False):
    # 运行于 PyInstaller 打包环境
    basedir = sys._MEIPASS
    os.environ["PLAYWRIGHT_BROWSERS_PATH"] = os.path.join(basedir, "playwright")
    os.environ["PLAYWRIGHT_DRIVER_PATH"] = os.path.join(basedir, "playwright") 